package org.czh;

import org.czh.rmi.HelloServiceImpl;
import org.czh.rmi.IHelloService;

import java.rmi.Naming;
import java.rmi.registry.LocateRegistry;

// 启动服务
public class RmiServer {
    public static void main(String[] args) throws Exception {
        // 注册服务端口、提供具体的服务并创建服务、发布远程服务
        LocateRegistry.createRegistry(1099);
        IHelloService helloService = new HelloServiceImpl();
        Naming.bind("rmi://localhost:1099/hello", helloService);
        System.out.println("服务启动成功");
    }
}